import {Component, inject, OnInit} from '@angular/core';
import {Rolegroup} from "../../../../model/auth/Rolegroup";
import {RoleGroupAuthCountVo} from "../../../../vo/auth/RoleGroupAuthCountVo";
import {AuthService} from "../../../../services/auth.service";
import {AlertService} from "../../../../services/alert.service";

@Component({
  selector: 'app-rolegrouplist',
  templateUrl: './rolegrouplist.component.html',
  styleUrl: './rolegrouplist.component.css'
})
export class RolegrouplistComponent  implements OnInit{
  rl:Array<RoleGroupAuthCountVo>;
  private authservice:AuthService=inject(AuthService);
  private alertservice:AlertService=inject(AlertService);


  constructor() {
    this.rl=new Array<RoleGroupAuthCountVo>();
  }

  ngOnInit(): void {
    this.getRoleGroupLIst();
  }

  getRoleGroupLIst(){
    this.authservice.getRolegroupList()
      .then((data:any)=>{
        if(data.msg=='ok'){
          this.rl=new Array<RoleGroupAuthCountVo>();
          this.rl=data.list;
        }
        else if(data.msg=='empty'){
          this.rl=new Array<RoleGroupAuthCountVo>();
        }
        else {
          this.alertservice.showError('获取用户组信息异常，请刷新后重试');
        }
      })
  }

}
